﻿using System.ComponentModel;
using System.Windows.Media;

namespace Demos.Spanning_Trees
{
    public abstract class ElementoVisual : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        public double X { get; set; }
        public double Y { get; set; }
        public string Identificador { get; set; }
        private Brush _color;
        public Brush Color
        {
            get { return _color; }
            set
            {
                _color = value;
                NotifyPropertyChanged("Color");
            }
        }
        private string _etiqueta;
        public string Etiqueta
        {
            get { return _etiqueta; }
            set
            {
                _etiqueta = value;
                NotifyPropertyChanged("Etiqueta");
            }
        }
    }

    public class VerticeVisual : ElementoVisual
    {
        public int Altura { get; set; }
        public int Anchura { get; set; }

        public VerticeVisual(double x, double y, int altura, int anchura, string contenido, string id, Brush color)
        {
            X = x;
            Y = y;
            Altura = altura;
            Anchura = anchura;
            Etiqueta = contenido;
            Identificador = id;
            Color = color;
        }
    }

    public class AristaVisual : ElementoVisual
    {
        public double X1 { get; set; }
        public double Y1 { get; set; }
        public double X2 { get; set; }
        public double Y2 { get; set; }

        public AristaVisual(double x, double y, double x1, double y1, double x2, double y2, string id, Brush color, string contenido)
        {
            X1 = x1;
            X2 = x2;
            Y1 = y1;
            Y2 = y2;
            X = x;
            Y = y;
            Identificador = id;
            Color = color;
            Etiqueta = contenido;
        }
    }
}
